package com.csg.ses.dao.ses;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.csg.ses.entity.ses.SysRolesEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 角色信息
 * @author wangjun
 * @date 2020/11/16
 */
@Mapper
public interface SysRolesDao extends BaseMapper<SysRolesEntity> {
    /**
	 * 自定义sql分页
	 * @param page
	 * @param qw
	 * @return
	 */
    IPage<SysRolesEntity> retrieve(IPage<SysRolesEntity> page, @Param(Constants.WRAPPER) Wrapper<SysRolesEntity> qw);

	@Select("select a.role_id from sys_roles a, sys_role_accounts b where b.role_id = a.role_id and a.use_flag = 'Y' and b.login_id = #{loginId} order by a.role_id asc ")
    List<String> getUserRoles(String loginId);

	List<SysRolesEntity> getRolesByRoleType(List<String> roleTypeIdList);

	Integer getNextId();

	Integer getNextrolerRightId();
}